﻿using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace Web.Framework
{
    public class UserInfo
    {
        public UserInfo(HttpContext context)
        {
            this.UserId = context.User.FindFirst("Id").Value;
            this.UserName = context.User.FindFirst("UserName").Value;
            this.SurName = context.User.Identity.Name;
            this.IsAdmin = Convert.ToInt32(context.User.FindFirst("IsAdmin").Value);
        }

        public string UserId
        {
            get; private set;
        }

        public string UserName
        {
            get; private set;
        }

        public string SurName
        {
            get; private set;
        }

        public int IsAdmin
        {
            get; private set;
        }

    }
}
